{template 'common/header'}
<!--<div class="panel panel-danger">
	    <div class="panel-heading">注意事项</div>
	    <div class="panel-body">
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-12 control-label" style="text-align: left;padding-right: 30px;">
               		 提示: 已经购买过的商品不能在修改，点击查看往期可以查看该商品的所有期数商品！ 
                </label>
                 <label class="col-xs-12 col-sm-2 col-md-2 col-lg-12 control-label" style="text-align: left;padding-right: 30px;">
             	   	 提示: 因为商品添加后夺宝码已经生成成功,所以不能在本期内修改价格了.
                </label>
	   		</div>
	    </div>
</div>-->
<style type='text/css'>
       .trbody td {text-align: center; vertical-align:top;border-left:1px solid #ccc; border-bottom: 1px solid #ddd;}
</style>
<style type="text/css">
	.main .form-horizontal .form-group{margin-bottom:0;}
	.main .form-horizontal .modal .form-group{margin-bottom:15px;}
	#modal-confirmsend .control-label{margin-top:0;}
</style>
<div class="main">
	<form class="form-horizontal form"  method="post" enctype="multipart/form-data" onsubmit="return formcheck(this)">
	<div class="panel panel-default">
			<div class="panel-heading">
				基本参数
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-6 col-sm-3 col-md-2 control-label">当前期数:</label>
					<div class="col-sm-3 col-xs-6">
						<p class="form-control-static">{$goods['periods']}</p>
					</div>
					<label class="col-xs-6 col-sm-3 col-md-2 control-label">商品名称:</label>
					<div class="col-sm-3 col-xs-6">
						<p class="form-control-static">{$goodslist['title']}</p>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-6 col-sm-3 col-md-2 control-label">目前所剩夺宝码个数：</label>
					<div class="col-sm-3 col-xs-6">
						<p class="form-control-static">{$goods['shengyu_codes']}</p>
					</div>
					<label class="col-xs-6 col-sm-3 col-md-2 control-label">商品期号:</label>
					<div class="col-sm-3 col-xs-6">
						<p class="form-control-static">{$goods['period_number']}</p>
					</div>
				</div>
			</div>
	</div>
    <div class="panel  panel-default">
	    <div class="panel-heading">添加机器人</div>
	    <div class="panel-body">
				<!--<div class="col-xs-12 col-sm-2" >
					<input type="text" name="code_num" class="form-control" value="{$code_num}"  placeholder="输入夺宝码个数."/>
					<label class="control-label">(购买夺宝码个数.)</label>
				</div>-->
                <div class="form-group">
                	<div class="col-xs-5 col-sm-3" >
						<label class="control-label">(机器人个数.建议每次创建个数小于100个)</label>
					</div>
					<div class="col-xs-5 col-sm-3" >
						<input type="text" name="limit_num" class="form-control" value="{$limit_num}" placeholder="输入个数上限."/>
					</div>
                       <div class="col-xs-5 col-sm-2"  style="text-align:right;">
                       		<button type="submit" name="sure" value="yes" class="btn btn-info">确定</button>
               		    </div>
                </div>
		</div>
	</div>
	<input type="hidden" name="token" value="{$_W['token']}" />
</form>
<form class="form-horizontal form"  method="post" enctype="multipart/form-data" action="{php echo $this->createWebUrl('machine',array('op'=>'used','goodsid'=>$id))}">
	<input type="hidden" name="periods" value="{$goods['periods']}" />
	<div class="panel  panel-default">
	    <div class="panel-heading">一次使用机器人</div>
	    <div class="form-group">
			<div class="col-sm-9 col-xs-12">
				<label class="col-xs-12 col-sm-2 col-md-2 control-label">可使用机器人个数：</label>
				<p class="form-control-static">{$machinesnum}</p>
			</div>
		</div>
	    <div class="panel-body">				
                <div class="form-group">
                	<div class="col-xs-12 col-sm-3" >
						<input type="text" name="code_num" class="form-control" value="{$code_num}"  placeholder="输入夺宝码个数."/>
						<label class="control-label">(购买夺宝码个数.)</label>
					</div>
					<div class="col-xs-12 col-sm-4" >
						<input type="text" name="limit_num" class="form-control" value="{$limit_num}" placeholder="输入个数上限."/>
						<label class="control-label">(使用机器人个数.建议单次使用小于100个)</label>
					</div>
	                <div class="col-sm-3"  style="text-align:right;">
	               		<button type="submit"  value="yes" class="btn btn-info">确定</button>
	       		    </div>
                </div>
		</div>
	</div>
</form>
<form class="form-horizontal form"  method="post" enctype="multipart/form-data" action="{php echo $this->createWebUrl('machine',array('op'=>'timeused','goodsid'=>$id))}">
	<input type="hidden" name="periods" value="{$goods['periods']}" />
	<div class="panel  panel-default">
	    <div class="panel-heading">自动计时购买机器人</div>
	    <div class="form-group">
			<div class="col-sm-9 col-xs-12">
				<label class="col-xs-12 col-sm-2 col-md-2 control-label">可使用机器人个数：</label>
				<p class="form-control-static">{$machinesnum}</p>
			</div>
		</div>
	    <div class="panel-body">				
                <div class="form-group">
                	<div class="col-xs-12 col-sm-3" >
						<input type="text" name="machine_num" class="form-control" value="{$machine_num}"  placeholder="购买夺宝码范围."/>
						<label class="control-label">(购买夺宝码范围)</label>
					</div>
					<div class="col-xs-12 col-sm-4" >
						<input type="text" name="timebucket" class="form-control" value="{$timebucket}" placeholder="机器人自动购买时间范围，以秒为单位."/>
						<label class="control-label">(机器人自动购买时间范围，以秒为单位)</label>
					</div>
	                <div class="col-sm-3"  style="text-align:right;">
	               		<button type="submit"  value="yes" class="btn btn-info">确定</button>
	       		    </div>
                </div>
                 <div class="form-group">
		            <div class="col-xs-12 col-sm-3">
		               {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i:s', $starttime),'endtime'=>date('Y-m-d H:i:s', $endtime)),true);}
		               <label class="control-label">(机器人使用时间段，仅仅取每天的时间段)</label>
		            </div>
		            <div class="col-xs-12 col-sm-4" >
						<input type="text" name="max_num" class="form-control" value="{$max_num}" placeholder="机器人购买数"/>
						<label class="control-label">(机器人购买数，默认不限制直到本期购买结束)</label>
					</div>
		    	</div>
		    	<div class="form-group">
					<label class="col-xs-8 col-sm-2 col-md-2 col-lg-2 control-label">连期购买</label>
			    	<div class="col-xs-8 col-sm-4" style="width: 25%;">
	                    <label class="radio radio-inline">
							<input type="radio" name="is_followed" value="0" {if $settings['is_followed']==0}checked="checked"{/if}> 关闭
						</label>
						<label class="radio radio-inline">
							<input type="radio" name="is_followed" value="1" {if $settings['is_followed']==1}checked="checked"{/if}> 开启
						</label>
					</div>
				</div>
		</div>
	</div>
</form>
{if $machines['status'] == 1}
<form class="form-horizontal form"  method="post" enctype="multipart/form-data" action="{php echo $this->createWebUrl('machine',array('op'=>'dele_machine','period_number'=>$goods['period_number']))}">
	<div class="panel panel-default">
			<div class="panel-heading">
				机器人正在运行中
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-6 col-sm-3 col-md-2 control-label">机器人运行时间段:</label>
					<div class="col-sm-3 col-xs-6">
						<p class="form-control-static">{php echo date("H:i",$machines['start_time'])}-{php echo date("H:i",$machines['end_time'])}</p>
					</div>
					<label class="col-xs-6 col-sm-3 col-md-2 control-label">剩余最大购买数:</label>
					<div class="col-sm-3 col-xs-6">
						<p class="form-control-static">{$machines['max_num']}</p>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-6 col-sm-3 col-md-2 control-label">购买数量范围：</label>
					<div class="col-sm-3 col-xs-6">
						<p class="form-control-static">{$machines['machine_num']}</p>
					</div>
					<label class="col-xs-6 col-sm-3 col-md-2 control-label">购买时间范围:</label>
					<div class="col-sm-3 col-xs-6">
						<p class="form-control-static">{$machines['timebucket']}</p>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-6 col-sm-3 col-md-2 control-label">{if $machines['is_followed'] == 1}连期购买中...{/if}</label>
				</div>
				<div class="col-sm-3"  style="text-align:right;">
	               		<button type="submit"  value="yes" class="btn btn-info">暂停机器人</button>
	       		</div>
			</div>
	</div>
</from>
{/if}
</div>
{template 'common/footer'}